package com.gzhu.knowledgeAdmin.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gzhu.knowledgeAdmin.common.result.R;
import com.gzhu.knowledgeAdmin.common.vo.CompanyVo;
import com.gzhu.knowledgeAdmin.entity.Gsxx;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.gzhu.knowledgeAdmin.service.GsxxService;

import javax.annotation.Resource;
import java.util.List;

/**
 * 
 *
 * @author giaogiao
 * @email giaogiao@gmail.com
 * @date 2023-06-09 15:42:41
 */
@RestController
@RequestMapping("knowledgeAdmin/gsxx")
public class GsxxController {
    @Autowired
    private GsxxService gsxxService;

    /**
     * 获取所有公司
     */
    @GetMapping("/list")
    public R list(){

        List<CompanyVo> list = gsxxService.getAllCompany();

        return R.ok(list);
    }
    @PostMapping("/selectALl")
    public R selectALl(@RequestParam(value = "gsid",defaultValue = "")String gsid){


//        List<Gsxx> list = gsxxService.list();

        List<Gsxx> list=gsxxService.selectAllGsxx(gsid);


        System.out.printf(list.toString());

        return R.ok(list);
    }
    @PostMapping("/insert")
    public R insert(@RequestBody Gsxx gsxx){


        boolean list = gsxxService.save(gsxx);


        return R.ok(list);
    }
    @PostMapping("/update")
    public R update(@RequestBody Gsxx gsxx){


        boolean list = gsxxService.updateById(gsxx);


        return R.ok(list);
    }
    @PostMapping("/delete")
    public R delete(@RequestBody Gsxx gsxx){


        boolean list = gsxxService.removeById(gsxx.getGsid());



        return R.ok(list);
    }





}
